<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ /*******************************************************************************
  ~  * Copyright (c) Jerges A. Bello G. 2014. Reservado todos los derechos.
  ~  ******************************************************************************/
  -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
<f:view>
    <t:saveState value="#{userModify}" />
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                    template="../../template/defaultMenuTemplate.xhtml">
    <ui:define name="content">
        <h:panelGrid columns="2" width="100%" cellpadding="0" cellspacing="0" columnClasses="panelGrid">
            <h:form id="modifyUserForm" style="text-space-collapse: preserve">
                <rich:panel style=" padding: 1px;width:300px;" bodyClass="inpanelBody">
                    <f:facet name="header">
                        <h:outputText value="#{BundleLabels.modify_user}"/>
                    </f:facet>
                    <h:outputText value="#{BundleLabels.user_name}"/>
                    <h:message showDetail="false" for="username" errorStyle="color: red" infoStyle="color: green"/>
                    <h:inputText id="username" value="#{userModify.userName}"
                                 required="true" validatorMessage="#{BundleLabels.validateInputEmpty}">
                        <!--<f:ajax render="clientOnServerSide" execute="@this"/>-->
                    </h:inputText>
                    <br/>
                    <h:outputText value="#{BundleLabels.name}"/>
                    <h:message showDetail="false" for="name" errorStyle="color: red" infoStyle="color: green"/>
                    <h:inputText id="name" value="#{userController.userTO.name}"
                                 required="true" validatorMessage="#{BundleLabels.validateInputEmpty}">
                        <!--<f:ajax render="clientOnServerSide" execute="@this"/>-->
                    </h:inputText>
                    <br/>
                    <h:outputText value="#{BundleLabels.lastName}"/>
                    <h:message for="lastname" errorStyle="color: red" infoStyle="color: green"/>
                    <h:inputText id="lastname"
                                 value="#{userController.userTO.lastName1}"
                                 required="true" validatorMessage="#{BundleLabels.validateInputEmpty}">
                        <!--<f:ajax render="clientOnServerSide" execute="@this"/>-->
                    </h:inputText>
                    <br/>
                    <h:outputText value="#{BundleLabels.documentId}"/>
                    <h:message for="typeDocument" errorStyle="color: red" infoStyle="color: green"/>
                    <h:message for="documentId" errorStyle="color: red" infoStyle="color: green"/>
                    <h:selectOneMenu id="typeDocument" value="#{userController.userTO.typeDocument}"
                                     required="true">
                        <f:selectItem itemValue="#{BundleLabels.NIE}" itemLabel="#{BundleLabels.NIE}"/>
                        <f:selectItem itemValue="P" itemLabel="#{BundleLabels.PASPPORT}"/>
                        <f:selectItem itemValue="#{BundleLabels.DNI}" itemLabel="#{BundleLabels.DNI}"/>
                        <f:selectItem itemValue="#{BundleLabels.NIF}" itemLabel="#{BundleLabels.NIF}"/>
                    </h:selectOneMenu>
                    <h:inputText id="documentId"
                                 value="#{userController.userTO.documentId}"
                                 required="true" validatorMessage="#{BundleLabels.validateInputEmpty}">
                        <!--<f:ajax render="clientOnServerSide" execute="@this"/>-->
                    </h:inputText>
                    <!--<f:ajax render="clientOnServerSide" execute="@this"/>-->

                    <br/>
                    <h:outputText value="#{BundleLabels.email}"/>
                    <rich:message for="email" errorStyle="color: red" infoStyle="color: green"/>
                    <h:inputText disabled="true" id="email"
                                 value="#{userController.userTO.email}"
                                 required="true" validatorMessage="#{BundleLabels.validateInputEmpty}">
                        <!--<f:ajax render="clientOnServerSide" execute="@this"/>-->
                        <!--<t:validateEmail message="#{BundleLabels.validateMailError}"/>-->
                        <f:validateRegex
                                pattern="^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+([;.](([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+)*$"/>
                        <rich:validator/>
                    </h:inputText>
                    <br/>
                    <h:outputText value="#{BundleLabels.password}"/>
                    <h:message for="password" errorStyle="color: red" infoStyle="color: green"/>
                    <h:inputSecret id="password" value="#{userController.userTO.security.password}"
                                   required="true" validatorMessage="#{BundleLabels.validateInputEmpty}">
                        <!--	<f:ajax render="clientOnServerSide" execute="@this"/>-->
                    </h:inputSecret>
                    <br/>
                    <br/>
                    <h:outputText value="#{BundleLabels.confirm_password}"/>
                    <h:message for="passwordRepeat" errorStyle="color: red" infoStyle="color: green"/>
                    <h:inputSecret id="passwordRepeat" value="#{userController.passworConfirm}"
                                   required="true" validatorMessage="#{BundleLabels.validateInputEmpty}"/>
                    <h:commandButton action="#{userController.updateUser}" value="#{BundleLabels.btn_update}"/>
                </rich:panel>
            </h:form>
        </h:panelGrid>
    </ui:define>
    </ui:composition>
</f:view>
</html>
